# import numpy.random as random
#
# count = 0  # 记录情况总数
# for i in range(0, 4):  # 等同于 i=0,i<4,i++
#     for j in range(0, 4):
#         for k in range(0, 7):
#             if i + j + k == 8:
#                 count = count + 1
# print('总数：', count)
#
# print('样例：')
# # d为字典，可用可不用
# d = {'r': 'red:', 'y': 'yellow:', 'g': 'green:', }
# # 题目要求随机输出几个样例，因此令黄球的个数随机，输出对应组合
# for r in random.randint(0, 3, 1):
#     for y in range(0, 4):
#         for g in range(0, 7):
#             if r + y + g == 8:
#                 print(d['r'], r, d['y'], y, d['g'], g)

k = {'r': "红色球", 'y': '黄色球', 'g': '绿色球'}
count = int(input("请问您想随机选几次："))
s = 0
for red in range(1, 4):
    for yellow in range(1, 4):
        for green in range(1, 7):
            if red + yellow + green == 8:
                print('第%d次选择:' % (s + 1))
                print(k['r'], red, k['y'], yellow, k['g'], green)
                s += 1
                if s == count:
                    exit()
